package com.yoso.mq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * @author shizejin
 * @date 2022/2/17
 * @description:
 */
@Configuration
public class DelayConfig {
    // 定义广播模式的延时交换机 无需绑定路由
/*    @Bean
    FanoutExchange delayExchange(){
        Map<String, Object> args = new HashMap<String, Object>();
        args.put("x-delayed-type", "direct");
        FanoutExchange topicExchange = new FanoutExchange("delay.exchange", true, false, args);
        topicExchange.setDelayed(true);
        return topicExchange;
    }
    @Bean
    public Queue delayPayQueue() {
        return new Queue("delay",true);
    }
    // 绑定延时队列与交换机
    @Bean
    public Binding delayPayBind() {
        return BindingBuilder.bind(delayPayQueue()).to(delayExchange());
    }*/

}
